'use strict';
const dayjs = require("dayjs");
const {getDefaultModelConfig} = require("../../utils/common");

module.exports = app => {
    const { STRING, INTEGER, DATE, TINYINT } = app.Sequelize;
    return app.model.define(
        'Banner',
        {
            id: {type: INTEGER, primaryKey: true, autoIncrement: true},
            image_url: STRING(255),
            link_url: STRING(255),
            location: {
                type: INTEGER,
                defaultValue: 0,
                // 0 首页 1课程
            },
            sort: {type: INTEGER, defaultValue: 0},
            status: {type: TINYINT, defaultValue: 1},
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'banner',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );
};
